﻿using System;
using System.Linq.Expressions;
using Domain.Core.Specification;
using Domain.MainModule.Entities;

namespace Domain.MainModule.RateParamTypes
{
    public class RateParamTypeNameSpecification : Specification<RateParamType>
    {
        #region public properties

        public string Name
        {
            get;
            set;
        }

        #endregion

        #region constructor

        public RateParamTypeNameSpecification(string name)
        {
            this.Name = name;
        }

        #endregion

        #region public methods

        public override Expression<Func<RateParamType, bool>> SatisfiedBy()
        {
            Specification<RateParamType> spec = new TrueSpecification<RateParamType>();
            spec &= new DirectSpecification<RateParamType>(c => c.Name == this.Name);

            return spec.SatisfiedBy();
        }

        #endregion
    }
}
